using System;
using System.ServiceModel;
using System.ServiceModel.Activation;

namespace GraphMyCode.Web
{
	public class CustomHostFactory : ServiceHostFactory
	{
		protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
		{
			int index = 1;

			if (baseAddresses.Length == 1)
				index = 0;
			CustomHost customServiceHost = new CustomHost(serviceType, baseAddresses[index]);

			return customServiceHost;
		}
	}

	class CustomHost : ServiceHost
	{
		public CustomHost(Type serviceType, params Uri[] baseAddresses) :
			base(serviceType, baseAddresses)
		{
		}

		protected override void ApplyConfiguration()
		{
			base.ApplyConfiguration();
		}
	}
}